home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14134 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  851 b 

  1. Path: news.umbc.edu!not-for-mail
  2. From: schlein@umbc.edu (Jonas J. Schlein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help:what is wrong this code?
  5. Date: 11 Apr 1996 18:43:28 -0400
  6. Organization: University of Maryland Baltimore County
  7. Message-ID: <4kk1ug$agm@umbc9.umbc.edu>
  8. References: <4k3p3q$n76@brahms.udel.edu>
  9. NNTP-Posting-Host: umbc9.umbc.edu
  10. NNTP-Posting-User: schlein
  11.  
  12. Yue-hong Zheng <yuehong@brahms.udel.edu> wrote:
  13. |> Why it give me 0.0000?
  14. |> 
  15. |> #include <stdio.h>
  16. |> main () {
  17. |> double a=9.008;
  18. |> printf("%f\n",sqrt(a));
  19. |> return 0;
  20. |> }
  21.  
  22. Have you tried adding the line: #include <math.h>?
  23.  
  24. If printf() thinks sqrt() is returning an int and the %f format has been
  25. specified (as it obviously is) that would account for your problem.
  26. -- 
  27. "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
  28.  
  29. Jonas J. Schlein  (schlein@gl.umbc.edu)
  30.